package com.bosssoft.itfinance.citizen.demo.biz.service.impl;

import com.bosssoft.itfinance.citizen.demo.biz.entity.Permission;
import com.bosssoft.itfinance.citizen.demo.biz.mapper.PermissionMapper;
import com.bosssoft.itfinance.citizen.demo.biz.service.IPermissionService;
import com.bosssoft.itfinance.citizen.demo.common.mybatis.base.BsBaseServiceImpl;
import org.apache.commons.collections.map.HashedMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * <p>
 * 权限信息表 服务实现类
 * </p>
 *
 * @author wangml
 * @since 2017-08-29
 */
@Service
public class PermissionServiceImpl extends BsBaseServiceImpl<PermissionMapper, Permission> implements IPermissionService {

    @Autowired
    private PermissionMapper permissionMapper;

    @Override
    public List<Permission> queryMenuByUser(String userId,Set<String> states) {
        if(!StringUtils.isEmpty(userId)) {
            Map<String,Object> param = new HashedMap();
            param.put("userId",userId);
            param.put("states",states);
            return permissionMapper.queryMenuByUser(param);
        }
        return null;
    }
}
